package com.start.platform.core.vo;

import com.alibaba.fastjson2.JSONObject;
import com.start.platform.core.entity.StartPlatformFans;
import com.start.platform.core.entity.StartPlatformUserEntity;
import lombok.Data;

import java.util.Map;

@Data
public class StartPlatformUserDetail extends StartPlatformUserEntity {
    private Map<String, Map<String, StartPlatformFans>> userFansMap;

    public static StartPlatformUserDetail create(StartPlatformUserEntity userEntity) {
        JSONObject jsonObject = JSONObject.from(userEntity);
        StartPlatformUserDetail startPlatformUserDetail = jsonObject.toJavaObject(StartPlatformUserDetail.class);
        return startPlatformUserDetail;
    }

    public static StartPlatformUserDetail create(StartPlatformUserEntity userEntity, Map<String, Map<String, StartPlatformFans>> userFansMap) {
        JSONObject jsonObject = JSONObject.from(userEntity);
        StartPlatformUserDetail startPlatformUserDetail = jsonObject.toJavaObject(StartPlatformUserDetail.class);
        startPlatformUserDetail.setUserFansMap(userFansMap);
        return startPlatformUserDetail;
    }
}
